package org.learnaholic.application.model;

import java.util.Map;

public class ListItemImpl implements ListItem
{
	private final String keyProperty;
	private final String id;
	private final Map<String, ItemProperty> properties;
	
	
	public ListItemImpl(String id, String keyProperty,Map<String, ItemProperty> properties)
	{
		this.id = id;
		this.keyProperty = keyProperty;
		this.properties = properties;
	}



	public String getId()
	{
		return id;
	}
	public String getKey()
	{
		return keyProperty;
	}
	public String getKeyValue()
	{
		return getProperty(keyProperty).toString();
	}

	public Map<String, ItemProperty> getProperties()
	{
		return properties;
	}

	public ItemProperty getProperty(String propertyName)
	{
		ItemProperty ret =properties.get(propertyName);
		if(null == ret)
		{
			ret = new ItemProperty("");
		}
		return ret;
	}

}
